#! /usr/bin/python


def GetUniqueWords(text):
  words = []
  wordsWithCount = dict()
  maxWords= []
  words = text.split()
  #print words
  for i in range(len(words)):
    if words[i] in wordsWithCount:
      wordsWithCount[words[i]] = wordsWithCount.get(words[i]) + 1
    else:
      wordsWithCount[words[i]] = 1
  #print wordsWithCount

  for x in range(10):
    maxWords.append(words[0])

  #print words[0]
  #print wordsWithCount
  for k,v in wordsWithCount.items():
    #print " = " + str(j)
    for w, big_word in enumerate(maxWords):
      #print "big_word = ", w, big_word, wordsWithCount[big_word]
      if wordsWithCount[k] > wordsWithCount[big_word]:
        maxWords.insert(w, k)
        print maxWords
        #for m in range(w):
        #  maxWords[len(maxWords)-m] = maxWords[len(maxWords)-(m-1)]
        #maxWords[w] = k
      break

  print maxWords     


  return '' # Change me!


def main():
  # Open the file, read it into memory as a single string.
  with open('alice_in_wonderland.txt') as alice_file:
    alice_text = alice_file.read()

  print 'Unique words:', GetUniqueWords(alice_text)


if __name__ == '__main__':
  main()
